<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p id="f"><br></p>
    <p id="x"><br></p>
    <script>
        let fruits = ["Apple", "Mango", "Banana", "Orange"];
        let names = new Array("Tom", "Miku", "maimai");
        document.getElementById("f").innerHTML = fruits;
        document.write(names + "<br>");
        document.getElementById("x").innerHTML = names[2];
        document.write(fruits.length + "<br>");
        //添加 1.索引添加  2.push
        names.push("千恋万花", "冰与火");
        document.write(names + "<br>");
        names[7] = "OSU!";
        document.write(names + "<br>");
        //修改也用索引改
        //遍历数组可以用索引for，也可以用forEach
        names.forEach((names, index) => {
            document.write(names + "<br>");
        })
        //当然还有多维数组之类的，用法差不多
        //空数组尽量let a=[],避免new Array()
        //也可以用函数返回数组
    </script>
</body>

</html>